Skip to content

Latest commit

 

History

History
250 lines (193 loc) · 7.99 KB

Choosing the deployment layout.adoc

File metadata and controls

250 lines (193 loc) · 7.99 KB

Choosing the deployment layout

Microservices Deployment

To deploy the XS2A service, one should use the following modules:

  • ASPSP profile (static configuration for your ASPSP)

  • Consent Management System (basic entities CRUD services and underlying database to store them)

  • XS2A library itself (xs2a-impl, implementation of NextGenPSD2 Interface of Berlin Group)

Each of the specified components is a separate jar file (or several files) that can be deployed on web-server or in a docker container. Each component can be started as a Spring Boot application and is written in Java 1.8 with Maven build system.

All of these can be deployed separately (using the network for communication) or as monolith in one server. This setup depends on the current bank network configuration, data security and available hardware. More details can be found at Getting started page.

These 3 services are basic configuration and to integrate them into whole ASPSP system one should use SPI implementation (connector between XS2A and ASPSP system) and ASPSP system.

When XS2A services are deployed as microservices there is risk of getting error (e.g. service unavailable) when we interacting with them. In this case the request should be protected against unavailability of remote services by catching ResourceAccessException error. When writing custom filters it’s recommended to extend GlobalAbstractExceptionFilter class and write code in doFilterInternalCustom method that handles this error.

Embedded Deployment

Embedding XS2A Library

In order to start Connector with embedded XS2A Library, one should use following annotations in SpringBootApplication:

@EnableXs2aSwagger

@EnableXs2aInterface

Also one needs following dependencies:

<properties>
    <xs2a.version>15.7</xs2a.version>
</properties>

XS2A implementation

<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>xs2a-impl</artifactId>
    <version>${xs2a.version}</version>
</dependency>
<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>xs2a-payment-common-impl</artifactId>
    <version>${xs2a.version}</version>
</dependency>

In XS2A Connector you have to implement SPI-API

But for testing purposes you can use SPI-STUB

<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>spi-stub</artifactId>
    <version>${xs2a.version}</version>
</dependency>

If you’ve chosen spi-stub, don’t forget add next annotation to app

@ComponentScan(basePackages = {"de.adorsys.psd2.stub"})

<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>event-service-rest-client</artifactId>
    <version>${xs2a.version}</version>
</dependency>

Working with ASPSP Profile remotely

<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>aspsp-profile-remote</artifactId>
    <version>${xs2a.version}</version>
</dependency>

Working with CMS remotely

<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>consent-xs2a-client</artifactId>
    <version>${xs2a.version}</version>
</dependency>

Also to start project as web application add

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

Add following properties and change it when necessary:

xs2a:
    endpoints:
        cors:
            # Whether credentials are supported. When not set, credentials are not supported.
            allow-credentials: false
            # Comma-separated list of origins to allow. '*' allows all origins. When not set, CORS support is disabled.
            allowed-origins: '*'
            # Comma-separated list of headers to include in a response.
            allowed-headers: '*'
            # Comma-separated list of methods to allow. '*' allows all methods. When not set, defaults to GET.
            allowed-methods: DELETE,GET,OPTIONS,PATCH,POST,PUT
            # How long, in seconds, the response from a pre-flight request can be cached by clients
            max-age: 3600
            # number of characters in a json string

For testing purposes without real QWAC certificate, you can start application with mock-qwac profile.

Embedding CMS Library

In order to start xs2a service with embedded CMS Library, one should use following annotations:

  • @EnableTransactionManagement

  • @EntityScan({"de.adorsys.psd2.consent.domain", "de.adorsys.psd2.event.persist.entity"})

  • @EnableJpaRepositories(basePackages = {"de.adorsys.psd2.consent.repository", "de.adorsys.psd2.event"})

  • @ComponentScan(basePackages = {"de.adorsys.psd2.report"})

Also one needs following dependencies:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>consent-management-lib</artifactId>
</dependency>
<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>cms-payment-support-impl</artifactId>
</dependency>
<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>consent-psu-web</artifactId>
</dependency>
<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>consent-aspsp-web</artifactId>
</dependency>
<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>consent-xs2a-web</artifactId>
</dependency>
<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>event-service-aspsp-impl</artifactId>
</dependency>
<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>cms-scheduler-service</artifactId>
</dependency>
<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>event-service-persist-db-impl</artifactId>
</dependency>

And following properties:

  • Datasource settings:

    • spring.datasource.url

    • spring.datasource.username

    • spring.datasource.password

  • JPA settings:

    • spring.jpa.properties.hibernate.default_schema

WARNING: For encryption\decryption of aspsp data we use secret server key ('server_key') which is read from Environment variables. So, before starting project you need to create environment variables and set value, as example: 'server_key=12345678' or run app with this parameter

Embedding Profile library

In order to start xs2a service with embedded APSPS Profile Library, one should add following dependencies:

<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>aspsp-profile-lib</artifactId>
    <version>${project.version}</version>
</dependency>
<dependency>
    <groupId>de.adorsys.psd2</groupId>
    <artifactId>aspsp-profile-web</artifactId>
    <version>${project.version}</version>
</dependency>

Also it’s required to add into org.springframework.boot plugin in pom file execution block:

<execution>
    <id>build-info</id>
    <goals>
        <goal>build-info</goal>
    </goals>
</execution>

Also, one needs to define property xs2a.license.url.

And if one have separate CMS service, that also communicates with ASPSP Profile, then one need to define property xs2a.cms.aspsp-profile.baseurl.